<!DOCTYPE html>
<html>
<head>
    <title>模具紧急维护</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <Date-picker type="daterange" v-model="q.month" placeholder="请选择起止日期"></Date-picker>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.faultType" placeholder="模具故障类别" :clearable="true">
                        <i-option v-for="faultType in faultTypeList" :value="faultType.id" :key="faultType.id">
                            {{faultType.typeName}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="4">
                    <i-input v-model="q.devName" @on-enter="query" placeholder="设备名称" :clearable="true"></i-input>
                </i-col>
                <i-col span="4">
                    <i-input v-model="q.moduleNo" @on-enter="query" placeholder="模具号" :clearable="true"></i-input>
                </i-col>
                <i-col span="2">
                    <i-select v-model="q.status" placeholder="状态" :clearable="true">
                        <i-option v-for="item in dev_status" :value="item.value" :key="item.value">{{item.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="2">
                    <i-select v-model="q.progress" placeholder="换件状态" :clearable="true">
                        <i-option v-for="item in progress_status" :value="item.value" :key="item.value">{{item.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("modulerepairrocord:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;报修</i-button>
                #end
                #if($shiro.hasPermission("modulerepairrocord:endProc"))
                <i-button type="info" @click="startRepair"><i class="fa fa-compass"></i>开始维修</i-button>
                #end
                #if($shiro.hasPermission("modulerepairrocord:endProc"))
                <!--<i-button type="info" @click="EndError"><i class="fa fa-compass"></i>完成</i-button>-->
                <i-button type="info" @click="mainte"><i class="fa fa-compass"></i>完成维修</i-button>
                #end
                #if($shiro.hasPermission("modulerepairrocord:commitCheck"))
                <i-button type="info" @click="commit"><i class="fa fa-upload"></i>&nbsp;提交换件审核</i-button>
                #end
                #if($shiro.hasPermission("modulerepairrocord:deptCheck"))
                <i-button type="primary" @click="deptCheck"><i class="fa fa-gavel"></i>&nbsp;审核换件</i-button>
                #end
                #if($shiro.hasPermission("modulerepairrocord:update"))
                <i-button type="warning" @click="doAction"><i class="fa fa-pencil-square-o"></i>&nbsp;完善维修记录</i-button>
                #end
                #if($shiro.hasPermission("modulerepairrocord:export"))
                <i-button type="warning" @click="exportData"><i class="fa fa-hand-o-up"></i>&nbsp;导出</i-button>
                #end
                #if($shiro.hasPermission("modulerepairrocord:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <table id="jqGrid"></table>
        </Row>
    </div>
    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="moduleRepairRocord" :rules="ruleValidate" :label-width="80">
            <Row>
                <i-col span="11">
                    <Form-item label="模具号" prop="moduleNo">
                        <i-input v-model="moduleRepairRocord.moldNo" placeholder="模具编号" readonly
                                 icon="md-arrow-dropdown-circle" @on-click="getModuleArchives"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="设备名称" prop="devName">
                        <i-input v-model="moduleRepairRocord.devName" placeholder="设备名称" icon="md-arrow-dropdown-circle"
                                 @on-click="getDeviceInfo"
                                 readonly></i-input>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2" v-show="false">
                    <Form-item label="设备编号" prop="devId">
                        <i-input v-model="moduleRepairRocord.devId" placeholder="设备ID" readonly></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="故障类型" prop="faultDesc">
                        <i-input type="text" v-model="moduleRepairRocord.faultDesc" icon="md-arrow-dropdown-circle"
                                 @on-click="typeTree" placeholder="故障类型" readonly></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="是否停线" prop="stoplineFlag">
                        <i-switch size="large" @on-change="changeStoplineFlag" v-model="stoplineFlag">
                            <span slot="open">是</span>
                            <span slot="close">否</span>
                        </i-switch>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="1" v-show="moduleRepairRocord.stoplineFlag == 1">
                    <Form-item label="停线开始时间" prop="stoplineStartTime">
                        <Date-picker type="datetime" v-model="moduleRepairRocord.stoplineStartTime"
                                     placeholder="请选择停线开始时间"></Date-picker>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="备注" prop="remark">
                        <i-input type="textarea" v-model="moduleRepairRocord.remark" :rows="3" maxlength="255"
                                 show-word-limit placeholder="请输入备注"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">
                    返回
                </i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 停线结束时间录入 -->
    <div id="inputStopLineStopTime" style="display: none;margin: 20px">
        <i-form>
            <Form-item label="停线结束时间" prop="stoplineEndTime">
                <Date-picker type="datetime" v-model="moduleRepairRocord.stoplineEndTime"
                             placeholder="请选择停线结束日期"></Date-picker>
            </Form-item>
        </i-form>
    </div>
    <!-- 审核表单区域 -->
    <div id="reviewLayer" style="padding: 20px;display: none">
        <i-form :model="approveParam" :label-width="80">
            <Form-item label="审核状态：">
                <Radio-group v-model="approveParam.status">
                    <Radio :label="1"><span>通过</span></Radio>
                    <Radio :label="2"><span>不通过</span></Radio>
                </Radio-group>
            </Form-item>
            <Form-item label="备注：">
                <i-input type="textarea" v-model="approveParam.remark" :rows="3" placeholder="请输入..."></i-input>
            </Form-item>
        </i-form>
    </div>
</div>
<div id="deptLayer" style="display: none;padding:10px;">
    <ul id="deptTree" class="ztree"></ul>
</div>
<div id="faultTypeLayer" style="display: none;padding:10px;">
    <ul id="faultTypeTree" class="ztree"></ul>
</div>

<script src="${rc.contextPath}/js/module/modulerepairrocord.js?_${date.systemTime}"></script>
</body>
</html>
